home *** CD-ROM | disk | FTP | other *** search
/ Workplace Effectiveness:…ecision-Making Strategies / Workplace Effectiveness: Decision-Making Strategies.iso / pc / Files / Review.dxr / 00032_Toggle Button.ls < prev    next >
Encoding:
Text File  |  1998-12-16  |  1.9 KB  |  46 lines

  1. property normalMember, NormalMemberNum, toggleMember, ImageCastLib, setting
  2.  
  3. on mouseDown me
  4.   Toggle(me)
  5. end
  6.  
  7. on Toggle me
  8.   setValue(me, not (the setting of me))
  9. end
  10.  
  11. on setValue me, v_me
  12.   if v_me = 0 then
  13.     set the member of sprite the spriteNum of me to the normalMember of me
  14.     set the setting of me to 0
  15.   else
  16.     set the member of sprite the spriteNum of me to the toggleMember of me
  17.     set the setting of me to 1
  18.   end if
  19.   updateStage()
  20. end
  21.  
  22. on beginSprite me
  23.   set s to the spriteNum of me
  24.   set the NormalMemberNum of me to the memberNum of sprite s
  25.   set the ImageCastLib of me to the number of castLib the castLibNum of sprite s
  26.   set the normalMember of me to member the NormalMemberNum of me of castLib the ImageCastLib of me
  27.   set the toggleMember of me to member the toggleMemberNum of me of castLib the ImageCastLib of me
  28.   setValue(me, the setting of me)
  29. end
  30.  
  31. on getPropertyDescriptionList
  32.   if the currentSpriteNum = 0 then
  33.     set memdefault to 0
  34.   else
  35.     set memref to the member of sprite the currentSpriteNum
  36.     set castLibNum to the castLibNum of memref
  37.     set memdefault to member (the memberNum of member memref + 1) of castLib castLibNum
  38.   end if
  39.   set p_list to [#toggleMemberNum: [#comment: "Toggle Image:", #format: #graphic, #default: memdefault], #setting: [#comment: "Initially Toggled:", #format: #boolean, #default: 0]]
  40.   return p_list
  41. end
  42.  
  43. on getBehaviorDescription
  44.   return "Makes a sprite work as a toggle button. The behavior responds when clicked, or when the SetValue or Toggle messages are receieved." & RETURN & "PARAMETERS:" & RETURN & "‚Ä¢ Toggle Image - Choose the cast member to display when the button is toggled." & RETURN & "‚Ä¢ Initially Toggled - Turn this option to make the button toggled when it first appears." & RETURN & "MESSAGES:" & RETURN & "‚Ä¢ SetValue {TRUE or FALSE} - Sets the toggle button." & RETURN & "‚Ä¢ Toggle - Switches the toggle button state."
  45. end
  46.